package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.ShoppingCart;

import java.util.List;

/**
 * @Author: dw
 * @Date 2022/3/16 23:44
 */
public interface ShoppingCartMapper {

    /**
     * 通过user_id查询所有购物车数据
     * @param userId
     * @return
     */
    List<ShoppingCart> findAll(Long userId);

    //根据userId查询购物车中当前菜品dish或套餐的setmealId购物车数据
    ShoppingCart findByShoppingCart(ShoppingCart shoppingCart);

    //更新指定购物车菜数据数量(number)，根据购物车主键更新数量(id)
    Integer updateNumber(ShoppingCart shoppingCart);

    //插入新的一条购物车数据(返回主键)
    Integer save(ShoppingCart shoppingCart);

    //根据用户id清空购物车
    Integer delete(Long userId);

    //通过dish_id或setmeal_id清空菜品数据
    Integer deleteByDishIdOrSetmealId(ShoppingCart shoppingCart);


}
